	<!-- 抽取结果 -->
<template>
	<!-- 录入信息 -->
	<div class=" content-right">
		<manualEntryInfo ref="manualEntryInfo" :insuredInfo="insuredInfo" :appntInfo="appntInfo" :peInfo="peInfo" :pageDisabled="true"></manualEntryInfo>
		<!-- 提交AI核保 -->
    <el-backtop target=".content-right"></el-backtop>
	</div>
</template>

<script>
import manualEntryInfo from "@/components/robot/manualEntryInfo.vue"  //客户信息、体检信息公用组件
import {
	getClientInfo,
	getPEInfo,
} from"@/api/taskCenter/manualEntry"
// import pageCall from "@/utils/pageCall";

export default {
	components: {
		// templateFile: templateFile,     //体检报告组件
		// manualEntryCoom,
    manualEntryInfo
	},
	data() {
		return {
			action: 0, // 1.核保 2.暂存
			tiffSrc: '',
			routeData: {},
			"appntInfo": {
				"age": "",
				"birthday": "",
				"clientCode": "",
				"clientName": "",
				"clientSecuityno": "",
				"clientType": "",
				"healthMap": {
					'1': []},
				"isDrink": "",  // id
				"isFewDrink": "",  // id
				"isSmoke": "",  // id
				"maritalStatus": "",  // id
				"sex": "",  // id
				"smokingAmount": ""
			},
			"insuredInfo": {
				"age": "",
				"birthday": "",
				"clientCode": "",
				"clientName": "",
				"clientSecuityno": "",
				"clientType": "",
				"healthMap": {
					'1': []},
				"isDrink": "",  // id
				"isFewDrink": "",  // id
				"isSmoke": "",  // id
				"maritalStatus": "",  // id
				"sex": "",  // id
				"smokingAmount": ""
			},
			peInfo: {
				riskPEs: [],
				rulePEs:  [],
			}
		}
	},
  activated(){
    let extractResultQuery = this.$route.path == '/home/maintenance/robouUnderwriting/intelligenceExtract/extractResult' ? sessionStorage.getItem('extractResultQuery') : sessionStorage.getItem('physicalRecordInfo')
    if(extractResultQuery) this.routeData = JSON.parse(extractResultQuery)
		this.queryData();
    this.$refs.manualEntryInfo.activeName = 'first'
		this.$refs.manualEntryInfo.appntOrInsure = '2'
  },
  mounted(){
  },
	methods: {
		queryData() {
			this.$store.dispatch('loading/CHANGE_LOADING', true);
			let params = {
				itemId: this.routeData.itemId,
				mainId: this.routeData.mainId,
				peOrgCode: this.routeData.peOrgCode,
				itemStatus: this.routeData.itemStatus,
				peCode: this.routeData.peCode
			}
			const clientPromise = getClientInfo(params).then(res => {
				// 后端数据格式查出是string，数据字典是int，不转换格式无法翻译
				res.data.appntInfo.sex = Number(res.data.appntInfo.sex)
				res.data.appntInfo.maritalStatus = Number(res.data.appntInfo.maritalStatus)
				res.data.insuredInfo.sex = Number(res.data.insuredInfo.sex)
				res.data.insuredInfo.maritalStatus = Number(res.data.insuredInfo.maritalStatus)
        if(res.data.appntInfo.clientType == '3') this.appntInfo = res.data.insuredInfo;
        else this.appntInfo = res.data.appntInfo;
				this.insuredInfo = res.data.insuredInfo;
			});
			const pePromise = getPEInfo(params).then(res => {
				res.data.rulePEs.forEach(item => {
					item.childPEVos.forEach(child => {
						let unitId = '';
						let unitName = '';
						child.units.forEach(unit => {
							if(unit.isDefault === '1'){
								unitId = unit.unitId;
								unitName = unit.unitName;
							}
						})
						child.unitId = unitId;
						child.unitName = unitName;
					})
				})
				this.peInfo = res.data;
        setTimeout(()=>{
          this.$refs.manualEntryInfo.expanHandle()
        },0)
			});
			Promise.all([clientPromise, pePromise]).then((client, pe) => {
				this.$store.dispatch('loading/CHANGE_LOADING', false)
			}).catch(() => {
				this.$store.dispatch('loading/CHANGE_LOADING', false)
			})
		},
	},
	created() {
	}
}

</script>

<style lang="less" scoped>
	@commonPadding: 20px;
	@commonBorder: 1px solid #e3dddd;

	.content-box {
		// overflow-x: scroll;
    display: flex;
		position: relative;
		padding-left: @commonPadding;
		padding-right: @commonPadding;
		margin-bottom: 20px;
    .content-right {
			min-width: 700px;
			// background-color: pink;
			position: absolute;
			top: 0;
			left: 590px;
			right: 0;
    }
	}

  /deep/ .fillcontain{
    padding: 25px 30px !important;
  }
  /deep/ .fillcontain .customer-tab-list {
    height: calc(100vh - 360px) !important;
    min-height: 250px;
  }
  /deep/ .fillcontain #pane-second .customer-tab-list {
    height: calc(100vh - 310px) !important;
  } 
</style>